package com.d3works.apps.account.service;

import com.d3works.apps.account.db.Account;
import com.d3works.apps.account.db.AccountingSituation;
import com.d3works.apps.base.db.BankDetails;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Partner;
import com.d3works.exception.D3worksException;
import com.d3works.meta.CallMethod;

public interface AccountingSituationService {

  AccountingSituation getAccountingSituation(Partner partner, Company company);

  String createDomainForBankDetails(
      AccountingSituation accountingSituation, boolean isInBankDetails);

  void updateCustomerCredit(Partner partner) throws D3worksException;

  /**
   * Get customer account from accounting situation or account config.
   *
   * @param partner
   * @param company
   * @return
   */
  Account getCustomerAccount(Partner partner, Company company) throws D3worksException;

  /**
   * Get supplier account from accounting situation or account config.
   *
   * @param partner
   * @param company
   * @return
   */
  Account getSupplierAccount(Partner partner, Company company) throws D3worksException;

  /**
   * Get employee account from accounting situation or account config.
   *
   * @param partner
   * @param company
   * @return
   */
  Account getEmployeeAccount(Partner partner, Company company) throws D3worksException;

  /**
   * Return bank details for sales to <code>partner</code> (took from SaleOrder.xml).
   *
   * @param company
   * @param partner
   * @return
   */
  @CallMethod
  BankDetails getCompanySalesBankDetails(Company company, Partner partner);

  /**
   * Get holdback customer account from accounting situation or account config.
   *
   * @param partner
   * @param company
   * @return
   */
  Account getHoldBackCustomerAccount(Partner partner, Company company) throws D3worksException;

  /**
   * Get holdback supplier account from accounting situation or account config.
   *
   * @param partner
   * @param company
   * @return
   */
  Account getHoldBackSupplierAccount(Partner partner, Company company) throws D3worksException;

  void setHoldBackAccounts(AccountingSituation accountingSituation, Partner partner)
      throws D3worksException;

  int determineVatSystemSelect(AccountingSituation accountingSituation, int vatSystem)
      throws D3worksException;
}
